import sqlHelper from './bookmarkSqlHelper'

// let _path = '../../'

let SQLite = require('../../common/SQLiteHelper').default

export default {
  async getBookmark () {
    try {
      return await SQLite.ExecuteReader(sqlHelper.getBookmark())
    } catch (e) {
      throw e
    }
  },
  async saveBookmark (bmid, rootid, nodeid, bmname, bmtype, cjsj) {
    try {
      return await SQLite.ExecuteNonQuery({
        executeSql: sqlHelper.saveBookmark(bmid, rootid, nodeid, bmname, bmtype, cjsj)
      })
    } catch (e) {
      throw e
    }
  },
  async deleteBookmark (bmid) {
    try {
      return await SQLite.ExecuteNonQuery({
        executeSql: sqlHelper.deleteBookmark(bmid)
      })
    } catch (e) {
      throw e
    }
  },
  async saveHistory (rootid, nodeid, bmtype) {
    try {
      return await SQLite.ExecuteNonQuery({
        executeSql: sqlHelper.saveHistory(rootid, nodeid, bmtype)
      })
    } catch (e) {
      throw e
    }
  }
}
